#include"udp_server.hpp"
#include<memory>
#include<cstdlib>


static void usage(std::string proc)
{
    //std::cout<<"\nUsage:"<<proc<<"ip port\n"<<std::endl;
    std::cout<<"\nUsage:"<<proc<<" port\n"<<std::endl;
}

// ./udp_server ip port   
//云服务器的问题造成bug？
int main(int argc,char* argv[])
{
    //./udp_server port 
    if(argc!=2)
    {
        usage(argv[0]);
        exit(1);
    }
    //std::string ip=argv[1];
    uint16_t port=atoi(argv[1]);//获取命令行输入的port和ip给下面创建对象
    std::unique_ptr<UdpServer>svr(new UdpServer(port));

    svr->initServer();//初始化服务器
    svr->Start();   //启动服务器
    return 0;
}